#include <iostream>
#include <stack>

using namespace std;

class Solution {
public:
    string convertToTitle(int n) {
        n--;
        stack<char> title_stack;
        while (1) {
            int quotient = n / 26;
            int remainder = n - quotient * 26;
            if (quotient < 26) {
                title_stack.push(remainder + 'A');
                if (quotient != 0) {
                    title_stack.push(quotient - 1 + 'A');
                }
                break;
            }
            n = quotient - 1;
            title_stack.push(remainder + 'A');
        }
        string title;
        title.resize(title_stack.size());
        for (int i = 0; i < title.length(); i++) {
            title[i] = title_stack.top();
            title_stack.pop();
        }
        return title;
    }
};
//17
int main() {
    Solution solution;
    string out = solution.convertToTitle(701);
    cout << out << endl;
    return 0;
}

